package top.mingtea.propertymannagement.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import top.mingtea.propertymannagement.pojo.Administrator;
import top.mingtea.propertymannagement.service.AdminService;
import org.springframework.web.bind.annotation.*;
@RestController
@RequestMapping("/admin")
public class AdministratorController {
    @Autowired
    private final AdminService adminService;
    public AdministratorController(AdminService adminService) {
        this.adminService = adminService;
    }

    @PostMapping("/doLogin")
    @ResponseBody
    public boolean login( String username,String password) {
        boolean isAuthenticated = adminService.dologin(username,password);
        if (isAuthenticated) {
            return true;
        } else {
            return false;
        }
    }
}
